console.info("hello world.");

/**
 * Main file
 */
const { app, BrowserWindow } = require('electron')
const pathModule = require('path')

const initMain = require('./main/init')


function createWindow() {
  const win = new BrowserWindow({
    width: 900,
    height: 600,
    webPreferences: {
      preload: pathModule.join(__dirname, 'preload', 'preload.js')
    },
    // frame: false,
    // titleBarStyle: 'hidden',
    // titleBarOverlay: true,
    // titleBarOverlay: {
    //   color: '#2f3241',
    //   symbolColor: '#74b1be',
    // },
    
  })

  win.loadFile(pathModule.join(__dirname, 'render', 'index.html'))

  initMain(win)

  win.webContents.openDevTools()
}

app.whenReady().then(() => {
  createWindow()

  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) {
      createWindow()
    }
  })
})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})